import bean.Bean;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.*;

class PickUpFactoryTest {

    PickUpFactory factory;

    @org.junit.jupiter.api.BeforeEach
    void setUp() {

        factory = PickUpFactory.getPickUP();
    }

    @org.junit.jupiter.api.Test
    void pickUp() throws Exception {

        List<Bean> list = new ArrayList<>();
        for (int i = 0; i < 11; i++) {
            Bean userPost = new Bean();
            userPost.setName("你好师姐" + i);
            userPost.setId(12345 * i + "");
            userPost.setEmail(null);
            list.add(userPost);
        }
        List<Map> li2 = factory.pickUp(list, "name", "id", "Email");
        li2.forEach((i) -> System.out.println(i.toString()));

    }

    @org.junit.jupiter.api.Test
    void pickUpSet() throws Exception {

        List<Bean> list = new ArrayList<>();
        for (int i = 0; i < 11; i++) {
            Bean userPost = new Bean();
            userPost.setName("你好师姐" + i);
            userPost.setId(12345 * i + "");
            userPost.setEmail(" ");
            list.add(userPost);
        }
        Set<String> li2 = factory.pickUpSet(list, "name", "id", "Email");
        li2.forEach((i) -> System.out.println(i.toString()));
    }

    @org.junit.jupiter.api.Test
    void pickUpList() throws Exception {

//        for (int i = 0; i < 11; i++) {
        Bean userPost = new Bean();
        userPost.setName("你好师姐");
        userPost.setId("12345");
        userPost.setEmail("124@13.com");
        Bean bean = new Bean();
        bean.setName("你好师姐");
        bean.setId("12345");
        bean.setEmail("124@13.com");
        List<String> list = new ArrayList<>();
        list.add("name");
        list.add("id");
        list.add(" ");
//        }
        List<String> li2 = factory.pickUpList(bean, list);
        li2.forEach((i) -> System.out.println(i.toString()));
    }

}